package com.indexingsystem.system.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.indexingsystem.boss.admin.mapper.AuthCodesMapper;
import com.indexingsystem.boss.common.PagedResult;
import com.indexingsystem.boss.entity.AuthCodes;
import com.indexingsystem.boss.utils.BeanUtils;
import com.indexingsystem.system.service.IAuthCodesService;

@Service
public class AuthCodesServiceImpl implements IAuthCodesService{

	@Resource
	private AuthCodesMapper authCodesMapper;
	@Override
	public int deleteByPrimaryKey(String authCodeId) {
		return authCodesMapper.deleteByPrimaryKey(authCodeId);
	}

	@Override
	public int insertSelective(AuthCodes record) {
		return authCodesMapper.insertSelective(record);
	}

	@Override
	public AuthCodes selectByPrimaryKey(String authCodeId) {
		return authCodesMapper.selectByPrimaryKey(authCodeId);
	}

	@Override
	public int updateByPrimaryKeySelective(AuthCodes record) {
		return authCodesMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public PagedResult<AuthCodes> selectAuthCodesList(Integer pageNo, Integer pageSize) {
		pageNo = pageNo == null?1:pageNo;
		pageSize = pageSize == null?10:pageSize;
		//startPage是告诉拦截器说我要开始分页了。分页参数是这两个。
		PageHelper.startPage(pageNo,pageSize);  
		return BeanUtils.toPagedResult(authCodesMapper.selectAuthCodesList());
		
	}

	@Override
	public int deleteAuthCodesByIdBatch(List<String> authCodeIdList) {
		return authCodesMapper.deleteAuthCodesByIdBatch(authCodeIdList);
	}
}